package com.moss.cloud.common.security.permission;

import com.alibaba.fastjson2.JSONObject;
import com.moss.cloud.common.core.model.from.AuthFrom;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;

@Component
@FeignClient(value = "moss-cloud-auth", contextId = "AuthRpcService")
public interface AuthRpcService {

    /**
     * 客户端认证
     *
     * @param authentication
     * @param contentType
     * @param cacheControl
     * @param authFrom
     * @return
     */
    @PostMapping(value = "/oauth/token",consumes = "application/x-www-form-urlencoded")
    JSONObject token(@RequestHeader(HttpHeaders.AUTHORIZATION) String authentication,
                     @RequestHeader(HttpHeaders.CONTENT_TYPE) String contentType,
                     @RequestHeader(HttpHeaders.CACHE_CONTROL) String cacheControl,
                     AuthFrom authFrom);
}
